"Hello, World!" report

This time, we will create a report displaying a greeting window before constructing with the help of a dialogue form. Create a new project in Delphi, and then put the "TfrxReport" and "TfrxDialogControls" components on the form. Call FastReport designer via double-clicking on the "TfrxReport" component and add a dialogue form into the report. Put the "TfrxLabelControl" and "TfrxButtonControl" objects on the form:

Set objects’ properties:

TfrxLabelControl:
Caption = 'Hello, World!'

TfrxButtonControl:
Caption = 'OK'
Default = True
ModalResult = mrOk

Set the "BorderStyle = bsDialog" property in the form. As we can see, both the controls and the form have the same set of properties as those in the corresponding Delphi controls.

As soon as setting of the dialogue form is finished, let us return to the report page and locate the "Text" object with any text in it there. Run the report and you will see the form:

When clicking on the "OK" button, a report will be constructed and displayed. If closing a form via the "Õ" button, the report will not be constructed. This is the mechanism of FastReport working: if there are dialogue forms in a report, it is constructed only when each form is closed with the "ÎÊ" button, i.e. it returns ModalResult = mrOk. That is why the "ModalResult" property of the button is set equal to "mrOk."